<?php
  require_once('dbConn.php');
  require_once('myFunc.php');
  //连接数据库		
  connect();

if(!empty($_FILES["pic"]["name"])){
  	$pic = uploadfile('pic',UserPhotoPath,array('jpg','gif','png'));
  }
  else{
  	$pic='';
  }

  $data = array(
		'lcy_title' => trim($_POST['lcy_title']),
    'lcy_place' => $_POST['lcy_place'],
    'lcy_intro' => $_POST['lcy_intro'],
    'lcy_pic'=>$pic
  	
    );

  //执行SQL语句
	$result = add('flower',$data);

  if(!$result){
  	echo "添加失败！<br/>";
  	echo "<a href='addflower.php'>返回</a>";	  
  }else{	  
 	  redirect('flowerlist.php','添加成功！');
  }    
  
?>